//
//  MTModel.m
//  MobTimes
//
//  Created by 江山 王 on 4/30/12.
//  Copyright (c) 2012 Finalist. All rights reserved.
//

#import "MTModel.h"

@implementation MTModel

@synthesize controller = _controller;
@synthesize isLoading = _isLoading;
@synthesize isReloading = _isReloading;

- (id)init {
    if (self = [super init]) {
    }
    return self;
}

- (id)initWithController:(id)controllerParam andURLStr:(NSString *)urlStr {
    self = [self init];
    _urlStr = [urlStr retain];
    _controller = controllerParam;
    return self;
}

- (void)dealloc {
    [_urlStr release];
    _urlStr = nil;
    [super dealloc];
}

#pragma mark - Public methods implementation

- (void)loadData {
    return [self doesNotRecognizeSelector:_cmd];
}

- (void)reloadData {
    return [self doesNotRecognizeSelector:_cmd];
}

- (void)didFinishLoad {
    if (_controller && [_controller isKindOfClass:[UITableViewController class]]) {
        UITableViewController *_tableViewController = (UITableViewController *)_controller;
        [_tableViewController.tableView reloadData];
    }
}

- (void)didFinishLoad:(MTURLRequest *)urlRequest {
    [self didFinishLoad];
}

#pragma mark - MTURLRequestDelegate

- (void)requestDidCancelLoad:(MTURLRequest *)request {
}

- (void)requestDidStartLoad:(MTURLRequest *)request {
}

- (void)request:(MTURLRequest *)request didFailLoadWithError:(NSError*)error {
}

- (void)requestDidFinishLoad:(MTURLRequest *)request {
    [self didFinishLoad:request];
}

@end